#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define MAXN 1005

const LL INF = 1000000000000000000LL;

int T;

LL N, query[MAXN];

vector< vector<LL> > bag;

pair <int, int> ans[MAXN];

vector< vector<> > dp;

void init() {
    for (int i = 0; (1LL << i) <= INF; i ++) {
        vector<LL> ins;
        LL now = 1LL;
        for (int j = 0; now * (1LL << i) <= INF; j ++) {
            ins.push_back((1LL << i) * now);
            now *= 3LL;
        }
        bag.push_back(ins);
    }
}

void work() {
    for (int i = 1; i <= T; i ++) {
        cin >> query[i];
    }
    dp.clear();      
    for (int i = 0; i < bag.size(); i ++) {
        for (int j = 0; j < bag[i].size(); j ++) {
        }
    }
}

int main() {
#ifndef __SKT__
    freopen("distribution.in", "r", stdin);
    freopen("distribution.out", "w", stdout);
#endif
    init();
    while (scanf("%d", &T) != EOF) {
        work();
    }
    return 0;
}
